package cn.nexd.location;

/**
 * Nexd 定位的配置类.
 * Created by codingfish on 15/9/28.
 */
public class NexdLocationConfig {

    public enum LocationMode {
        WIFI_ONLY, BLUETOOTH_ONLY, MIX
    }

    public String appKey;
    public LocationMode locationMode;
    public int locationRate;
    public boolean smoothness;
    public String locationConfigPath;

    public NexdLocationConfig(Buidler buidler) {
        this.appKey = buidler.app_key;
        this.locationMode = buidler.locationMode;
        this.locationRate = buidler.locationRate;
        this.smoothness = buidler.smoothness;
        this.locationConfigPath = buidler.locationConfigPath;
    }


    public static class Buidler {
        private String app_key = "";

        private LocationMode locationMode = LocationMode.WIFI_ONLY;

        private int locationRate = 1000;

        private boolean smoothness = false;

        private String locationConfigPath = "";

        public NexdLocationConfig build() {
            return new NexdLocationConfig(this);
        }

        /**
         * 设置 AppKey
         *
         * @param app_key
         */
        public Buidler setAppkey(String app_key) {
            this.app_key = app_key;
            return this;
        }

        /**
         * 设置定位模式
         *
         * @param locationMode WiFi Bluetooth
         */
        public void setLocationMode(LocationMode locationMode) {
            this.locationMode = locationMode;
        }

        /**
         * 设置定位频率,单位毫秒.
         *
         * @param locationRate
         */
        public void setLocationRate(int locationRate) {
            this.locationRate = locationRate;
        }

        /**
         * 是否启用定位平滑效果.默认情况下不启用.
         * 这是一个极度危险的选项,建议使用默认配置,在启用之前请与 SDK 开发人员联系.
         *
         * @param smoothness
         */
        public void setSmoothness(boolean smoothness) {
            this.smoothness = smoothness;
        }


        /**
         * 设置定位配置文件的存放目录.只在离线定位的情况下生效.
         * 如果开发者没有显式的配置该路径,那么将采用默认的最佳路径.
         *
         * @param locationConfigPath 定位配置的文件目录例如 /sdcard/nexd/
         */
        public void setLocationConfigPath(String locationConfigPath) {
            this.locationConfigPath = locationConfigPath;
        }
    }
}
